//
//  CZEmoticon.swift
//  git
//
//  Created by 徐 鹏超 on 16/4/15.
//  Copyright © 2016年 徐 鹏飞. All rights reserved.
//

import UIKit

class CZEmoticon: NSObject {
    
    var chs: String?
    
    var png: String?
    
    var code:String?{
        didSet{
            // 1. 创建一个扫描对象
            let scanner = NSScanner(string: code!)
            // 2. 创建一个UInt32的变量
            var result: UInt32 = 0
            // 3. 扫描转换
            scanner.scanHexInt(&result)
            // 4. 把result转换成Unicode
            let nuicode = UnicodeScalar(result)
            // 5. 把unicode转换成Character
            let character = Character(nuicode)
            // 6. 把 Character 转换成字符串
            //            print("\(character)")
            emoji = "\(character)"
        }

    }
    var emoji: String?
    
    var path: String?
    
    init(dic:[String :NSObject ]) {
        super.init()
        
        setValuesForKeysWithDictionary(dic)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
         
    }
    
    
    
}
